package model.entity;

import java.util.HashMap;

public class Task {
	private int coordinate;
	private String type;
	private int duration;
	private int remaining;
	private int profit;
	private int penalty;
	private String status;
	private Integer tmp; 
	
	public Task(HashMap<String, String> a) {
		status = a.get("status");
		type = a.get("type");
		String str = a.toString();
		//System.out.println(str);
		profit= Integer.parseInt(str.substring(str.indexOf("profit")+7, str.indexOf(",", str.indexOf("profit")+7)));
		duration = Integer.parseInt(str.substring(str.indexOf("duration")+9, str.indexOf(",", str.indexOf("duration")+9)));
		remaining = Integer.parseInt(str.substring(str.indexOf("remaining")+10, str.indexOf(",", str.indexOf("remaining")+10)));
		coordinate = Integer.parseInt(str.substring(str.indexOf("coordinate")+11, str.indexOf(",", str.indexOf("coordinate")+11)));
		penalty = Integer.parseInt(str.substring(str.indexOf("penalty")+8, str.indexOf(",", str.indexOf("penalty")+8)));
		//System.out.println("fuck: " +a);
		//{profit=4, duration=12, remaining=12, status=free, coordinate=10, penalty=3, type=c++}
		//a.toString().substring("coordinate", endIndex)
		//duration = Integer.parseInt(a.get("duration"));
		/*coordinate = Integer.parseInt(a.get("coordinate"));
		duration = Integer.parseInt(a.get("duration"));
		remaining =Integer.parseInt(a.get("remaining"));
		profit =Integer.parseInt(a.get("profit"));
		penalty =Integer.parseInt(a.get("penalty"));
		*/
	}
	
	public int getCoordinate() {
		return coordinate;
	}
	public void setCoordinate(int coordinate) {
		this.coordinate = coordinate;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public int getDuration() {
		return duration;
	}
	public void setDuration(int duration) {
		this.duration = duration;
	}
	public int getRemaining() {
		return remaining;
	}
	public void setRemaining(int remaining) {
		this.remaining = remaining;
	}
	public int getProfit() {
		return profit;
	}
	public void setProfit(int profit) {
		this.profit = profit;
	}
	public int getPenalty() {
		return penalty;
	}
	public void setPenalty(int penalty) {
		this.penalty = penalty;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}

}
